using System;
using System.Collections.Generic;
using Assets;
using HarmonyLib;
using PegasusLettuce;

namespace Mercenary
{
    //UI元素
    public class UiItem
    {
        public readonly int m_id;
        public readonly string m_name;

        public UiItem(int id, string name)
        {
            m_id = id;
            m_name = name;
        }
    }

    //佣兵技能
    public class MercSkill
    {
        public int m_id = -1;
        public string m_name;
        public int m_speed;
        public int m_damage;

        public MercSkill(int id, string name)
        {
             m_id = id;
             m_name = name;
        }
    }

    //佣兵装备
    public class MercEquip
    {
        public int m_id = -1;
        public string m_name;

        public MercEquip(int id, string name)
        {
             m_id = id;
             m_name = name;
        }
    }

    //佣兵英雄
    public enum TAG_ROLE
    {
        INVALID,
        CASTER,
        FIGHTER,
        TANK,
        NEUTRAL
    }
    public class MercCard
    {
        public int m_id = -1;
        public string m_name;
        public bool m_enable;
        public TAG_ROLE m_role;
        public int m_curHealth;
        public int m_defHealth;
        public int m_curSpeed;
        public int m_slotEquip;
        public List<MercSkill> m_skills;
        public List<MercEquip> m_equips;

        public MercCard() {}

        public MercCard(int id, string name)
        {
            m_id = id;
            m_name = name;
        }

        /*
        public MercCard(int id)
        {
            m_id = id; 
        }

        public MercCard(string name)
        {
             m_name = name;
        }

        

        public MercCard(int id, int slot)
        {
             m_id = id;
             m_slotEquip = slot;
        }

        public MercCard(int id, string name, List<MercSkill> skills, List<MercEquip> equips)
        {
             m_id = id;
             m_name = name;
             m_skills=skills;
             m_equips=equips;
        }

        public MercCard(string name, int id, int curHealth, int curSpeed, int defHealth)
        {
            m_name = name;
            m_id = id;
            m_curHealth = curHealth;
            m_curSpeed = curSpeed;
            m_defHealth = defHealth;
        }
        */
    }

    public enum TargetType_E
    {
        Unspecified = 0,
        Friendly = 1
    }

    public class BattleTarget
    {
        public int m_frieTarId = -1;
        public string m_frieTarName = "";
        public int m_oppoTarId = -1;
        public string m_oppoTarName = "";
        public int m_skillId = -1;
        public string m_skillName = "";
        public int m_subSkillId = -1;
        public string m_subSkillName = "";
        public TargetType_E m_targetType = TargetType_E.Unspecified;
        public bool m_bAllowOption = true;
    }

    public class Map
    {
        public readonly int m_id;
        public readonly string m_name;

        public Map(int id)
        {
            m_id = id;
        }

        public Map(int id, string name)
        {
            m_id = id;
            m_name = name;
        }
    }

    public class Task
    {
        public int m_taskId;
        public int m_priority;
        public string m_map;
        public bool m_bComplet;
        public int m_water;//流水号，保证同优先级的任务是按照添加顺序排列的（长时间不重启可能会溢出）
        public int m_mercId;
        public string m_title;
        public string m_desc;
        public long m_startTime;

        public Task(int taskId, int priority, string map, bool bComplet,
            int water, int mercId, string title, string desc)
        {
            m_taskId=taskId;
            m_priority=priority;
            m_map=map;
            m_bComplet=bComplet;
            m_water=water;
            m_mercId=mercId;
            m_title=title;
            m_desc=desc;
        }
    }

    public interface IStrategy
    {
        string Name();

        List<MercCard> GetMercList();

        void UpdateMercList();

        List<BattleTarget> GetBattleTargets(
            int turn,
            List<MercCard> targets_opposite_all,
            List<MercCard> targets_friendly_all,
            List<MercCard> targets_opposite_graveyrad);

        (int hand_index, int play_index) GetEnterOrder(
            List<MercCard> hand_mercenaries,
            List<MercCard> play_mercenaries);
    }
}
